//
//  DYBottomView.m
//  BaiSi
//
//  Created by mac on 16/11/2.
//  Copyright © 2016年 DeYi. All rights reserved.
//

#import "DYBottomView.h"
#import "DYThemeItem.h"
@interface DYBottomView ()
@property (weak, nonatomic) IBOutlet UIButton *dingBtn;
@property (weak, nonatomic) IBOutlet UIButton *caiBtn;
@property (weak, nonatomic) IBOutlet UIButton *shareBtn;
@property (weak, nonatomic) IBOutlet UIButton *reviewBtn;

@end

@implementation DYBottomView

- (void)setItem:(DYThemeItem *)item {
    [super setItem:item];
    [self setButtonTitle:_dingBtn withCount:item.ding];
    [self setButtonTitle:_caiBtn withCount:item.cai];
    [self setButtonTitle:_shareBtn withCount:item.repost];
    [self setButtonTitle:_reviewBtn withCount:item.comment];
  
}

- (void)awakeFromNib {
    self.autoresizingMask = UIViewAutoresizingNone;
}

- (void)setButtonTitle:(UIButton *)button withCount:(NSInteger)count{
    NSString *str = [NSString stringWithFormat:@"%ld",count];
    if (count > 10000) {
        str = [NSString stringWithFormat:@"%0.1f万",count / 10000.0];
        str = [str stringByReplacingOccurrencesOfString:@".0" withString:@""];
    }
    [button setTitle:str forState:UIControlStateNormal];
}
@end
